package com.gitee.feizns.web.dao.handler.meta;

import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;

import java.util.List;

/**
 * @author feizns
 * @since 2019/7/26
 */
public class GeneralMetaObjectHandler extends MetaObjectHandler {

    /**
     * 处理器列表
     */
    private List<FillInputHandler> handlers;

    public GeneralMetaObjectHandler(List<FillInputHandler> handlers) {
        this.handlers = handlers;
    }

    @Override
    public void insertFill(MetaObject metaObject) {
        if ( handlers != null )
            handlers.stream().forEach(handler -> handler.insertFill(metaObject));
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        if ( handlers != null )
            handlers.stream().forEach(handler -> handler.updateFill(metaObject));
    }

}
